<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
      <%@ page import="prescription.*,java.util.*" %>
    <%@ taglib prefix="jstl" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- select_patients.php显示所有的病人
select_patients.js处理该页面上的按钮
select_patients_1.php为select_patients.js中处理显示病人详情的处理php -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>选择病人</title>
<style type="text/css">
			#content{
				
			}
			#content2{
			
			}
			.field1{
				width:40%;
				text-align: center;
				margin:5 auto auto 20;
				float:left;
			}
			.field2{
				width:40%;
				text-align: center;
				float:center;
			}
			.search_content{
				margin :10 40 40 40;
				text-align: center;
				width: 80%;
			}
			.navigation{
				margin: 0 auto;
				width:95%;
				border:0px;
				text-align: center;
			}
	</style>
	<script type="text/javascript" src="include/jquery-2.1.1.min.js">
	</script>
	<script type="text/javascript" >
	$('document').ready(function(){

	//点击查看详情后，右边将会显示该病人的信息
		$('.more_info').click(function(){
			
			var name = $(this).prev().prev().prev().prev().val();
			var gender = $(this).prev().prev().prev("input:hidden").val();
			var identity = $(this).prev().prev().val();
			var age = $(this).prev("input:hidden").val();
		    $("#content2").html("姓名:"+name+"<br/>"+"年龄："+age+"<br/>");
		    $("#content2").append("性别："+gender+"<br/>"+"身份证号："+identity);

           
		});
 
	
		$('.choose').click(function(){
			
			 //点击选择后发送get请求
			 $.get("session.do",{id:$(this).prev().val()},function(data){
			//	alert("ok");
				 window.location = "visiting_doctor.jsp";

				 });
		
				
				
		});
});
	</script>
</head>
<body>
<h1>病人选择   id:<jstl:out value="${sessionScope.id} "/></h1>
<jstl:import  url="include/header.html" charEncoding="UTF-8"/> 
<fieldset class="search_content">
		<form>
		<input type="text" name="condition1" placeholder="请输入病人信息关键字"/>
		<input type="button" name="button" id="button" value="查询"/>
		</form>
	</fieldset>
	<fieldset class="field1">
		<div id="content">
			<table>
				<jstl:forEach items="${patients}" var="patient">
					<tr><td>${patient['name']}</td>
						<td><input type="hidden" value="${patient['name']}"/>
							<input type="hidden" value="${patient['gender']}"/>
							<input type="hidden" value="${patient['identityCard']}"/>
							<input type="hidden" value="${patient['age']}"/>
						<a class='more_info' >查看详细</a>
						<input type="hidden" value="${patient['id']}"/>
						<input type='button' class='choose' value='确定'/></td>
					</tr> 
				</jstl:forEach>
			</table>		
		</div>
	</fieldset>
	<fieldset class="field2">
		<h2>病人信息</h2>
		<div id="content2">
			
			<p></p>
		</div>
	</fieldset>

</body>
</html>